/*
 * @FilePath: /web-vue/src/api/system.js
 * @Description: 系统模块后台API
 */
import request from "@/utils/request";

/**
 * 查询【系统日志】
 */
const querySysLog = (parameter) => {
  return request({
    method: "GET",
    url: "api/SysLog/retrieval",
    params: parameter,
  });
};

/**
 * 查询单个【系统日志】
 */
const queryOneSysLog = (parameter) => {
  return request({
    method: "GET",
    url: "api/SysLog/find/parameter",
  });
};

/**
 * 新增【系统日志】
 */
const addSysLog = (parameter) => {
  return request({
    method: "POST",
    url: "api/SysLog/add",
    data: parameter,
  });
};

/**
 * 修改【系统日志】
 */
const modifySysLog = (parameter) => {
  return request({
    method: "PUT",
    url: "api/SysLog/modify",
    data: parameter,
  });
};

/**
 * 批量删除【系统日志】
 */
const batchDelSysLog = (parameter) => {
  return request({
    method: "DELETE",
    url: "api/SysLog/remove",
    data: parameter,
  });
};

/**
 * 查询【部门】
 */
const querySysDepartment = (parameter) => {
  return request({
    method: "GET",
    url: "system/api/dept/retrieval",
    params: parameter,
  });
};

/**
 * 查询单个【部门】
 */
const queryOneSysDepartment = (parameter) => {
  return request({
    method: "GET",
    url: "api/SysDepartment/find/parameter",
  });
};

/**
 * 新增【部门】
 */
const addSysDepartment = (parameter) => {
  return request({
    method: "POST",
    url: "system/api/dept/add",
    data: parameter,
  });
};

/**
 * 修改【部门】
 */
const modifySysDepartment = (parameter) => {
  return request({
    method: "PUT",
    url: "system/api/dept/modify",
    data: parameter,
  });
};

/**
 * 批量删除【部门】
 */
const batchDelSysDepartment = (parameter) => {
  return request({
    method: "DELETE",
    url: `system/api/dept/remove/${parameter}`,
    // data: parameter,
  });
};

/**
 * 查询【菜单】
 */
const querySysMenu = (parameter) => {
  return request({
    method: "GET",
    url: "system/api/user/menu",
    params: parameter,
  });
};

/**
 * 新增【菜单】
 */
const addSysMenu = (parameter) => {
  return request({
    method: "POST",
    url: "system/api/menu/add",
    data: parameter,
  });
};

/**
 * 修改【菜单】
 */
const modifySysMenu = (parameter) => {
  return request({
    method: "PUT",
    url: "system/api/menu/modify",
    data: parameter,
  });
};

/**
 * 批量删除【菜单】
 */
const batchDelSysMenu = (parameter) => {
  return request({
    method: "DELETE",
    url: `system/api/menu/remove/${parameter}`,
    data: parameter,
  });
};

/**
 * 查询【角色】
 */
const querySysRole = (parameter) => {
  return request({
    method: "GET",
    url: "system/api/role/retrieval",
    params: parameter,
  });
};

/**
 * 查询【角色列表】
 */
const querySysRoleList = (parameter) => {
  return request({
    method: "GET",
    url: "system/api/role/list",
    params: parameter,
  });
};

/**
 * 查询单个【角色】
 */
const queryOneSysRole = (parameter) => {
  return request({
    method: "GET",
    url: "api/SysRole/find/parameter",
  });
};

/**
 * 新增【角色】
 */
const addSysRole = (parameter) => {
  return request({
    method: "POST",
    url: "system/api/role/add",
    data: parameter,
  });
};

/**
 * 修改【角色】
 */
const modifySysRole = (parameter) => {
  return request({
    method: "PUT",
    url: "system/api/role/modify",
    data: parameter,
  });
};

/**
 * 批量删除【角色】
 */
const batchDelSysRole = (parameter) => {
  return request({
    method: "DELETE",
    url: `system/api/role/remove/${parameter}`,
    // data: parameter,
  });
};

/**
 * 查询【角色菜单关联表】
 */
const querySysRoleMenu = (parameter) => {
  return request({
    method: "GET",
    url: `system/api/role/menu/list/${parameter}`,
    // params: parameter,
  });
};

/**
 * 查询单个【角色菜单关联表】
 */
const queryOneSysRoleMenu = (parameter) => {
  return request({
    method: "GET",
    url: "api/SysRoleMenu/find/parameter",
  });
};

/**
 * 新增【角色菜单关联表】
 */
const addSysRoleMenu = (parameter) => {
  return request({
    method: "POST",
    url: "api/SysRoleMenu/add",
    data: parameter,
  });
};

/**
 * 修改【角色菜单关联表】
 */
const modifySysRoleMenu = (parameter) => {
  return request({
    method: "POST",
    url: "api/SysRoleMenu/modify",
    data: parameter,
  });
};

/**
 * 批量删除【角色菜单关联表】
 */
const batchDelSysRoleMenu = (parameter) => {
  return request({
    method: "POST",
    url: "api/SysRoleMenu/remove",
    data: parameter,
  });
};

/**
 * 角色授权菜单
 */
const authMenu = (parameter) => {
  return request({
    method: "PUT",
    url: "system/api/role/auth/menu",
    data: parameter,
  });
};

/**
 * 授权【角色数据域】
 */
const authDataScope = (parameter) => {
  return request({
    method: "PUT",
    url: "system/api/role/auth/dataScope",
    data: parameter,
  });
};

/**
 * 查询【系统用户】
 */
const querySysUser = (parameter) => {
  return request({
    method: "GET",
    url: "system/api/user/retrieval",
    params: parameter,
  });
};

/**
 * 查询单个【系统用户】
 */
const queryOneSysUser = (parameter) => {
  return request({
    method: "GET",
    url: `system/api/user/find/${parameter}`,
  });
};

/**
 * 新增【系统用户】
 */
const addSysUser = (parameter) => {
  return request({
    method: "POST",
    url: "system/api/user/register",
    data: parameter,
  });
};

/**
 * 修改【系统用户】
 */
const modifySysUser = (parameter) => {
  return request({
    method: "PUT",
    url: "system/api/user/modify",
    data: parameter,
  });
};

/**
 * 批量删除【系统用户】
 */
const batchDelSysUser = (parameter) => {
  return request({
    method: "DELETE",
    url: `system/api/user/remove/${parameter}`,
    // data: parameter,
  });
};

/**
 * 查询【用户部门关联表】
 */
const querySysUserDept = (parameter) => {
  return request({
    method: "GET",
    url: "api/SysUserDept/retrieval",
    params: parameter,
  });
};

/**
 * 查询单个【用户部门关联表】
 */
const queryOneSysUserDept = (parameter) => {
  return request({
    method: "GET",
    url: "api/SysUserDept/find/parameter",
  });
};

/**
 * 新增【用户部门关联表】
 */
const addSysUserDept = (parameter) => {
  return request({
    method: "POST",
    url: "api/SysUserDept/add",
    data: parameter,
  });
};

/**
 * 修改【用户部门关联表】
 */
const modifySysUserDept = (parameter) => {
  return request({
    method: "POST",
    url: "api/SysUserDept/modify",
    data: parameter,
  });
};

/**
 * 批量删除【用户部门关联表】
 */
const batchDelSysUserDept = (parameter) => {
  return request({
    method: "POST",
    url: "api/SysUserDept/remove",
    data: parameter,
  });
};

/**
 * 查询【用户角色关联表】
 */
const querySysUserRole = (parameter) => {
  return request({
    method: "GET",
    url: `system/api/user/bindRoles/${parameter}`,
    // params: parameter,
  });
};

/**
 * 查询单个【用户角色关联表】
 */
const queryOneSysUserRole = (parameter) => {
  return request({
    method: "GET",
    url: "api/SysUserRole/find/parameter",
  });
};

/**
 * 新增【用户角色关联表】
 */
const addSysUserRole = (parameter) => {
  return request({
    method: "POST",
    url: "api/SysUserRole/add",
    data: parameter,
  });
};

/**
 * 修改【用户角色关联表】
 */
const modifySysUserRole = (parameter) => {
  return request({
    method: "POST",
    url: "api/SysUserRole/modify",
    data: parameter,
  });
};

/**
 * 批量删除【用户角色关联表】
 */
const batchDelSysUserRole = (parameter) => {
  return request({
    method: "POST",
    url: "api/SysUserRole/remove",
    data: parameter,
  });
};

/**
 * 用户登录
 */
const userLoginAuth = (parameter) => {
  return request({
    method: "POST",
    url: "login/auth",
    data: parameter,
  });
};

/**
 * 退出登录
 */
const userLogout = (parameter) => {
  return request({
    method: "POST",
    url: "logout",
    data: parameter,
  });
};

/**
 * 获取用户列表
 */
const getUserList = (parameter) => {
  return request({
    url: "system/api/user/retrieval",
    method: "GET",
    params: parameter,
  });
};

/**
 * 编辑用户列表
 */
const editUser = (parameter) => {
  return request({
    method: "POST",
    url: "system/api/user/retrieval/edit",
    data: parameter,
  });
};

/**
 * 菜单列表
 */
const getCurrentUserMenu = (parameter) => {
  return request({
    method: "GET",
    url: "system/api/user/menu",
    params: parameter,
  });
};

/**
 * 【个人信息修改】
 */
const modifyOwnInfo = (parameter) => {
  return request({
    method: "PUT",
    url: "system/api/user/own_center/modify",
    data: parameter,
  });
};

/**
 * 【个人密码修改】
 */
const modifyOwnPassword = (parameter) => {
  return request({
    method: "PUT",
    url: "system/api/user/own_password/modify",
    params: parameter,
  });
};

// 导出系统模块相关接口
export default {
  querySysLog,
  queryOneSysLog,
  addSysLog,
  modifySysLog,
  batchDelSysLog,
  querySysDepartment,
  queryOneSysDepartment,
  addSysDepartment,
  modifySysDepartment,
  batchDelSysDepartment,
  querySysMenu,
  addSysMenu,
  modifySysMenu,
  batchDelSysMenu,
  querySysRole,
  querySysRoleList,
  queryOneSysRole,
  addSysRole,
  modifySysRole,
  batchDelSysRole,
  querySysRoleMenu,
  queryOneSysRoleMenu,
  addSysRoleMenu,
  modifySysRoleMenu,
  batchDelSysRoleMenu,
  authMenu,
  authDataScope,
  querySysUser,
  queryOneSysUser,
  addSysUser,
  modifySysUser,
  batchDelSysUser,
  querySysUserDept,
  queryOneSysUserDept,
  addSysUserDept,
  modifySysUserDept,
  batchDelSysUserDept,
  querySysUserRole,
  queryOneSysUserRole,
  addSysUserRole,
  modifySysUserRole,
  batchDelSysUserRole,
  userLoginAuth,
  userLogout,
  getUserList,
  editUser,
  getCurrentUserMenu,
  modifyOwnInfo,
  modifyOwnPassword,
};
